package cn.fancy.sdk.pay.view;

import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import cn.fancy.sdk.common.utils.ResUtil;
import cn.fancy.sdk.entity.SdkBaseInfo;
import cn.fancy.sdk.pay.GuildPayActivity;

public class SuccessDialog extends Dialog {
	private GuildPayActivity mActivity;

	public SuccessDialog(GuildPayActivity activity,
			android.view.View.OnClickListener onClickListener) {
		super(activity);
		mActivity = activity;
		getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.setContentView(ResUtil.getLayoutId(activity,
				"guild_pay_success_dialog"));
		this.setCancelable(false);
		TextView desTv = (TextView) this.findViewById(ResUtil.getId(activity,
				"guild_paysuccess_des"));
		Button confirmBt = (Button) this.findViewById(ResUtil.getId(activity,
				"guild_paysuccess_comfirm"));
		confirmBt.setOnClickListener(onClickListener);
		String des = getContext().getResources().getString(
				ResUtil.getStringId(activity, "guild_pay_success"));

		String servTel = SdkBaseInfo.getServTel(mActivity.getBaseContext());

		if (servTel != null) {
			des = String.format(des, servTel == null ? "" : servTel);
		} else {
			des = String.format(des, "");
		}
		desTv.setText(des);
	}
}
